gusucode.com > GUI界面实现语音增强matlab源码程序 > speech enhancement/winner.m

    function y=winner(x,n)
%this function complete speech enhance with winner filter .
%x is a .wav file squency;
%n is the number of a  frame speech;
L=length(x);
N=ceil(L/n);

noise_psd=prepower(x,15,n,2);

for k=1:n:N*(n-1),
   for j=1:n,
      if (k+j>L)
      x(k+j)=0;
      end;

      x_window(j)=x(k+j-1);
   end;
   X=fft(x_window,n);
   phase=angle(X);
   X=sum2(X,2);
   S=max((X-noise_psd),0);
   G_k=S./X;
   A=G_k.*(X.^0.5);
   S=A.*exp(i*phase);
   s(k:k+n-1)=ifft(S,n);
end;

y=s;